<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2009 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace common\behavior;

use common\model\OrderTaskFileListModel;
use Webman\Stomp\Client;

/**
 * 行为扩展：更新订单文件状态
 */
class UpdateOrderStatusBehavior
{

    /**
     * 处理记录route
     * @param $param
     */
    public function run(&$param)
    {
        $orderTaskFileListList = model(OrderTaskFileListModel::class)->where(['id' => $param['primary_id']])
            ->field('order_id')->group('order_id')->select();
        foreach ($orderTaskFileListList as $item) {
            Client::send('update_order_file_status', build_queue_data_with_xu(['id' => $item['order_id']]), 3);
        }
    }
}
